# 移除列表中的重复元素
# 自己写的第一种
yuan_list = [2, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 6, 7, 8, 9]

final_list = set(yuan_list)
print(list(final_list))


# 自己写的第二种
def remove_elements(list1, list2):
    for i in list1:
        if i not in list2:
            list2.append(i)
        else:
            continue
    return list2


list1 = [2, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 6, 7, 8, 9]
list2 = []
print(remove_elements(list1, list2))


# 网站写的.但他写的更像是从一个列表移除另一个列表的元素
def remove_elements1(list3, list4):
    for i in list4:
        list3.remove(i)
    return list3


list3 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
list4 = [1, 2, 3]
print(remove_elements1(list3, list4))
